<?php
class AboutAction extends FrontAction {
    private $db = FALSE;
    protected function init() {
        if(!$this->checkConsoleLogin()) {
            $this->redirect('member/login');
            exit;
        }
        $this->assign('user',$this->user);
        $this->assign('user_info',$this->user_info);
    }
    public function index() {
        $data = F('about','');
        if(!empty($data['qq'])){
            foreach((array)$data['qq'] as $v){
                $tmp .= $v.',';
            }
            $data['qq'] = trim($tmp,',');
            unset($tmp);
        }
        $this->assign('data',$data);
        $this->display();
    }
    public function aboutAddPost(){
        if ($this->post){
           
            $data['phone'] = h($_POST['phone']);
            $data['mobile'] = abs($_POST['mobile']);
            $data['contact'] = h($_POST['contact']);
            $data['qq'] = explode(',',trim($_POST['qq'],','));
            $data['qq_group'] = $_POST['qq_group'];
            $data['address'] = h($_POST['address']);
            F('about',$data,DATA_PATH);
            alert('添加成功','about/index');
            exit;
        }
        
        exit;
    }
}
?>
